﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RoomShowRulePage : MonoBehaviour {

    //房间里显示规则用的参数
    public Button closeBtn;
    //选择局数
    public Text chapterMax;
    //选择支付方式
    public Text payType;
    //看牌设置
    public Text LookCard;
    //底分设置
    public Text botScore;
    //其他设置
    public Text otherSet;

	void Start () {
        closeBtn.onClick.RemoveAllListeners();
        closeBtn.onClick.AddListener(CloseBtnClick);
        SetChapterMax(PlayerPrefs.GetString("chapterMax"));
        SetPayType(PlayerPrefs.GetString("payType"));
        SetLookCard(PlayerPrefs.GetString("lookCard"));
        SetBotScore(PlayerPrefs.GetString("botScore"));
        SetOtherSet(PlayerPrefs.GetString("otherSet"));
	}

    public void SetChapterMax(string str)
    {
        if (str == "8")
        {
            chapterMax.text = "8局";
        }
        else if (str == "16")
        {
            chapterMax.text = "16局";
        }
    }

    public void SetPayType(string str)
    {
        if (str == "AAPay")
        {
            payType.text = "AA支付";
        }
        else if (str == "homeOwnerPay")
        {
            payType.text = "房主支付";
        }
    }

    public void SetLookCard(string str)
    {
        switch (str)
        {
            case "0":
                LookCard.text = "不闷";
                break;
            case "1":
                LookCard.text = "闷一轮";
                break;
            case "2":
                LookCard.text = "闷二轮";
                break;
            case "3":
                LookCard.text = "闷三轮";
                break;
            default:
                break;
        }
    }

    public void SetBotScore(string str) 
    {
        switch (str)
        {
            case "1":
                botScore.text = "1分";
                break;
            case "2":
                botScore.text = "2分";
                break;
            case "5":
                botScore.text = "5分";
                break;
            case "10":
                botScore.text = "10分";
                break;
            case "20":
                botScore.text = "20分";
                break;
            default:
                break;
        }
    }

    public void SetOtherSet(string str)
    {
        if (str == "金花大")
        {
            otherSet.text = "金花大";
        }
        else if(str == "顺子大")
        {
            otherSet.text = "顺子大";
        }
    }

    public void CloseBtnClick()
    {
        DestroyImmediate(gameObject);
    }
}
